"""
with...open
离开了with的代码块，就会直接释放资源

"""
#读取文件
with open(r"1.txt","r",encoding="utf8") as f:
    s=f.read()
print(s)

#使用with...open 写入文件
with open(r"2.txt","w",encoding="utf8") as f:
    f.write("hello world")